package com.umeox.watch.moto.chat.db

import androidx.room.*

/**
 * Created by Rambo 2021/8/18
 * Describe:
 */
@Dao
interface ContactInfoDao {

    @Query("SELECT * FROM contact_info ORDER BY lastContactTime DESC")
    fun loadAllContacts(): List<ContactInfo>

    @Query("SELECT * FROM contact_info WHERE id =:id")
    fun queryById(id: Long): ContactInfo?

    @Query("SELECT * FROM contact_info WHERE friendId = :friendId")
    fun queryByFriendId(friendId: String): ContactInfo?

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun save(contactInfo: ContactInfo)

    @Delete
    fun delete(contactInfo: ContactInfo):Int

    @Delete
    fun delete(contactInfo: List<ContactInfo>)
}